<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h2>对象浅拷贝实现</h2>
</body>
<script>
    
    const obj1={
        name:'jack',
        age:18,
        info:{
            address:'北京'
        }
    }

    //const obj2={...obj1}
    const obj2=Object.assign({},obj1)


    obj2.name='李强'
    obj2.info.address='河南'

    console.log(obj1);
    console.log(obj2);

    //数组浅拷贝
    const arr=[11,22,33,{name:'张三'}]
   // const arr2=arr.slice()
    const arr2=arr.concat()

    

    arr2[3].name='五老五'
    console.log(arr)
    console.log(arr2)



   
</script>
</html>